package mysqlviewer.gui;

/**
 *
 * @author  agoesh
 */
public class StatusBar extends javax.swing.JPanel {

    /** Creates new form StatusBar */
    public StatusBar() {
        initComponents();
    }
    /*
     * 1. Siap Tapi Tidak Tehubung ke database
     * 2. Sibuk
     * 3. Siap dan telah tehubung
     */
    public void setStatus(int status){
        String teksApp, toolTips, iconApp, iconKoneksi;
        switch(status){
            default:
                iconApp="idle.png";
                iconKoneksi="not_conected.png";
                
                teksApp="Aplikasi Siap ...";
                toolTips="Tidak Tersambung";
            break;
            case 2:
                iconApp="busy.png";
                iconKoneksi="not_conected.png";
                
                teksApp="Aplikasi Sibuk, Harap Tunggu";
                toolTips="Tidak Tersambung";
            break;
            case 3:
                iconApp="idle.png";
                iconKoneksi="conected.gif";
                
                teksApp="Tersambung ke Database";
                toolTips=teksApp;
            break;
        }
        labelAplikasi.setIcon(new javax.swing.ImageIcon(getClass().getResource("/mysqlviewer/resource/"+iconApp)));
        labelAplikasi.setText(teksApp);

        labelKoneksi.setIcon(new javax.swing.ImageIcon(getClass().getResource("/mysqlviewer/resource/"+iconKoneksi))); // NOI18N
        labelKoneksi.setToolTipText(toolTips);
    }

    @SuppressWarnings("unchecked")
    // <editor-fold defaultstate="collapsed" desc="Generated Code">//GEN-BEGIN:initComponents
    private void initComponents() {

        labelAplikasi = new javax.swing.JLabel();
        labelKoneksi = new javax.swing.JLabel();

        setBorder(javax.swing.BorderFactory.createEtchedBorder(javax.swing.border.EtchedBorder.RAISED));

        labelAplikasi.setIcon(new javax.swing.ImageIcon(getClass().getResource("/mysqlviewer/resource/idle.png"))); // NOI18N
        labelAplikasi.setText("Aplikasi Siap ...");

        labelKoneksi.setIcon(new javax.swing.ImageIcon(getClass().getResource("/mysqlviewer/resource/not_conected.png"))); // NOI18N
        labelKoneksi.setToolTipText("Tidak Tersambung");

        javax.swing.GroupLayout layout = new javax.swing.GroupLayout(this);
        this.setLayout(layout);
        layout.setHorizontalGroup(
            layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(layout.createSequentialGroup()
                .addComponent(labelAplikasi)
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, 291, Short.MAX_VALUE)
                .addComponent(labelKoneksi))
        );
        layout.setVerticalGroup(
            layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                .addComponent(labelAplikasi)
                .addComponent(labelKoneksi))
        );
    }// </editor-fold>//GEN-END:initComponents


    // Variables declaration - do not modify//GEN-BEGIN:variables
    private javax.swing.JLabel labelAplikasi;
    private javax.swing.JLabel labelKoneksi;
    // End of variables declaration//GEN-END:variables

}
